package com.crm.customers.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.crm.base.dao.BaseDao;
import com.crm.customers.dao.CustomerInfoTempDao;
import com.crm.customers.model.CustomerInfoTemp;

@Repository("customerInfoTempDao")
public class CustomerInfoTempDaoImpl extends BaseDao implements CustomerInfoTempDao {
	
	private static final String MAPPER_NAMESAPCE = "CustomerInfoTempMapper.";

	@Override
	public int insert(CustomerInfoTemp cif) {
		return insert(MAPPER_NAMESAPCE+"insert", cif);
	}

	@Override
	public List<CustomerInfoTemp> getAllCustomerInfoTempList(
			CustomerInfoTemp cif) {
		List<CustomerInfoTemp> list = selectList(MAPPER_NAMESAPCE+"getAllCustomerInfoTempList", cif);
		if (list != null && list.size() > 0) {
			list.get(0).setTotalResults((Integer)selectOne(MAPPER_NAMESAPCE+"getAllCustomerInfoTempListCount", cif));
		}
		return list;
	}

	@Override
	public int update(CustomerInfoTemp cif) {
		return update(MAPPER_NAMESAPCE+"update", cif);
	}

	@Override
	public CustomerInfoTemp getCusInfoTempById(Long id) {
		return selectOne(MAPPER_NAMESAPCE+"getCusInfoTempById", id);
	}

	@Override
	public int delete(CustomerInfoTemp c) {
		return delete(MAPPER_NAMESAPCE+"delete", c);
	}

	@Override
	public List<CustomerInfoTemp> getListByParams(CustomerInfoTemp c) {
		List<CustomerInfoTemp> list = selectList(MAPPER_NAMESAPCE+"getListByParams", c);
		if (list != null && list.size() > 0) {
			list.get(0).setTotalResults((Integer)selectOne(MAPPER_NAMESAPCE+"getListCountByParams", c));
		}
		return list;
	}

	@Override
	public int checkTelIsExist(CustomerInfoTemp c) {
		return selectOne(MAPPER_NAMESAPCE+"checkTelIsExist", c);
	}

}
